/*

Dofile: table12_appendix.do 

Date: Dec. 10, 2016 
Aim: Present the baseline regressions (using effective marginal taxe rate data) - [0-100] thresholds 

Input: base_for_reg.dta 
Output: table12_appendix.xls 
Reported in the paper: "Table A.12: Baseline regression Effective Marginal Tax Rate, all firms, 10%-90% thresholds"

*/  

cd $datapath
use base_for_reg, clear 

global name table12_appendix // name of the xls file where the results are sent 

global tax_var inter_linvemtr linvemtr // tax variable and its interaction 
areg luv type $tax_var if tarif!=. , absorb(fpt) vce(cluster pays)
outreg2  type $tax_var inter_tarif tarif inter_lgdpc lgdpc inter_ldist ldist  using  "$resultpath/$name.xls" ,  label e(all) nocons bdec(2) symbol($^{***}$, $^{**}$, $^{*}$) adjr2    replace 

areg luv type $tax_var inter_tarif tarif inter_lgdpc lgdpc inter_ldist ldist   , absorb(fpt) vce(cluster pays)
outreg2  type $tax_var inter_tarif tarif inter_lgdpc lgdpc inter_ldist ldist    using  "$resultpath/$name.xls" ,  label e(all) nocons bdec(2) symbol($^{***}$, $^{**}$, $^{*}$) adjr2    append 

global tax_var interdum_hines dum_hines
areg luv type $tax_var inter_tarif tarif inter_lgdpc lgdpc inter_ldist ldist  , absorb(fpt) vce(cluster pays)
outreg2  type $tax_var inter_tarif tarif inter_lgdpc lgdpc inter_ldist ldist    using  "$resultpath/$name.xls" ,  label e(all) nocons bdec(2) symbol($^{***}$, $^{**}$, $^{*}$) adjr2   append 

global tax_var interdum_hines dum_hines inter_linvemtr linvemtr 
areg luv type $tax_var inter_tarif tarif inter_lgdpc lgdpc inter_ldist ldist    , absorb(fpt) vce(cluster pays)
outreg2  type $tax_var inter_tarif tarif inter_lgdpc lgdpc inter_ldist ldist    using  "$resultpath/$name.xls" ,  label e(all) nocons bdec(2) symbol($^{***}$, $^{**}$, $^{*}$) adjr2   append 

areg luv type $tax_var inter_tarif tarif inter_lgdpc lgdpc inter_ldist ldist  if dum_hines==0, absorb(fpt) vce(cluster pays)
outreg2  type $tax_var inter_tarif tarif inter_lgdpc lgdpc inter_ldist ldist  using  "$resultpath/$name.xls" ,  label e(all) nocons bdec(2) symbol($^{***}$, $^{**}$, $^{*}$) adjr2    append 

global tax_var interdum_hines  inter_linvemtr // level variables not included - absorbed by the FE 
reghdfe luv type $tax_var inter_tarif inter_lgdpc inter_ldist  if tarif!=. , absorb(fpt c) vce(cluster pays)
outreg2  type $tax_var inter_tarif tarif inter_lgdpc lgdpc inter_ldist ldist   using  "$resultpath/$name.xls" ,  label e(all) nocons bdec(2) symbol($^{***}$, $^{**}$, $^{*}$) adjr2    append 

